package work20241203_chap6oop.m_demo10;

/**
 * @author zdl
 * @date 2024/12/5
 */
public class Account {
    private long id;
    private double balance;
    private String password;

    public Account() {
    }

    public Account(long id, double balance, String password) {
        this.id = id;
        this.balance = balance;
        this.password = password;
    }

    /**
     * 获取
     * @return id
     */
    public long getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * 获取
     * @return balance
     */
    public double getBalance() {
        return balance;
    }

    /**
     * 设置
     * @param balance
     */
    public void setBalance(double balance) {
        this.balance = balance;
    }

    /**
     * 获取
     * @return password
     */
    public String getPassword() {
        return null;
    }

    /**
     * 设置
     * @param password
     */
    public void setPassword(String password) {
        if (password.length() == 6){
            this.password = password;
        }else {
            System.out.println("密码长度必须为6位");
        }

    }

    public String toString() {
        return "Account{id = " + id + ", balance = " + balance + ", password = " + password + "}";
    }
}
